package com.hopu.iocdemo1;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * 配置类 必须添加@Configuration
 */
@Configuration
//配置扫描的包
@ComponentScan(basePackages = "com.hopu.iocdemo1")
public class MyConfig {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext cxt = new AnnotationConfigApplicationContext(MyConfig.class);
        Computer computer = cxt.getBean(Computer.class);
        computer.start();
    }
}
